import {
    T_GraphsConfigItem2,
    T_KonvaGroupConfig,
} from '@/types/graphs-konva.ts'
export interface T_Camera_Video_List_Request_Condition {
    addr?: string;
    filename?: string;
    confirmed?: boolean | '';
    reset?: boolean | '';
    reason_code?: number | '';
    type: number;
    carType?: string;
    carColor?: string;
    VINcode?: string;
    dateRange: {
        start: number;
        end: number;
    } | null;
    sort: {
        filename?: 'ascending' | 'descending';
        video_start?: 'ascending' | 'descending';
        video_end?: 'ascending' | 'descending';
        size?: 'ascending' | 'descending';
    }
}

export interface T_Data_Event_Row {

    _id: string; // 事件id

    addr: string; // 相机ip

    event_name?: string; // 事件名

    event_type: string; // 事件类型

    event_time: number;  // 事件日期

    ui_event_time?: string; // 格式化后的事件日期
}


export type T_Device_ClientSide_Cam_NodeDetails = {
    sortNum?: number;
    _id: string;
    alias?: string;
    hasAssignedToViewportOfThisIndex?: undefined | (() => number);
    online?: boolean;
    name?: string;
    ipAddress: string;
    addr?: string;
    reason?: string;

    reason_code?: number;
    helmetStatus?: {
        reason_code?: number;
        isWarning?: boolean;
    },
    phoneStatus?: {
        reason_code?: number;
        isWarning?: boolean;
    },
    currentRtspUri: string;
    isWarning?: boolean;
    rtspFullUri_List: Array<{ label: string; value: string }>;
    currentPipelineId: string;
    pipelineIds: Array<{ label: string; value: string; }>;
    currentStreamId: string;
    streamList: Array<{ label: string; value: string; }>;
    konvaConfigMap: Map<string, {
        configKonvaList?: Array<T_KonvaGroupConfig>
    }>;
    konvaConfigList?: Array<T_GraphsConfigItem2>;
    konvaConfigRois?: Map<string, Array<T_GraphsConfigItem2> | [] | undefined>;
};
export type T_Device_ClientSide_Cam_VideoRect = {
    sortNum?: number;
    _id: string;
    alias?: string;
    hasAssignedToViewportOfThisIndex?: undefined | (() => number);
    name?: string;
    konvaConfigList: Array<T_GraphsConfigItem2> | [] | undefined;
};

export interface T_RectDelayListItem {
    delayTime?: number;
    konvaConfigList: T_GraphsConfigItem2[] | null;
    _id: string;
    class_id: string;
    results: any;
}
export interface T_RectGraphResultItem {
    class_id: string;
    class_name?: string;
    action_idx?: string;
    confidence: number;
    frame: {
        width: number;
        height: number;
    };
    bbox: {
        left: number;
        top: number;
        width: number;
        height: number;
    };
    color?: Array<string | number>;
    start_time?: number; // 开始时间
    end_time?: number; // 结束时间
}
export interface T_Camera_Video_Row {

    _id: string; // 视频id
    camera_id: string;
    confirmed: boolean; // 是否告警确认
    reseted: boolean; // 是否批量告警复位
    pipeline: string;
    pipeline_id: string;
    reason: string; // 告警类型
    reason_code: number;
    addr: string; // 相机ip

    filename?: string; // 文件名
    timestamp: number;
    storage_addr: string  //文件所属服务器ip

    video_start?: number; // 开始时间

    video_end?: number; // 结束时间

    size?: string | number; // 视频文件大小 单位是Bytes

    video_url?: string; // 视频地址
    image?: string[]; // 手机偷拍-图片地址

    video_start_format?: number | string;
    video_end_format?: number | string;
    video_time_view?: string | number;
    overlay?: string;
    results: Array<
        T_RectGraphResultItem
    >;
}

export interface T_SocketPipelineMovementData {
    batched_results: Array<{
        camera_id: string;
        model: string;
        pipeline_id: string;
        pipeline?: string;
        results: Array<
            {
                class_id?: string;
                class_name?: string;
                confidence: number;
                frame: {
                    width: number;
                    height: number;
                };
                bbox: {
                    left: number;
                    top: number;
                    width: number;
                    height: number;
                };
                color?: Array<string | number>;
            }
        >;
    }>;
}

/* 联电----报警列表table */
export interface T_Warn_List_Row {
    _id: string; // 视频id
    addr: string; // 相机ip
    event_code: number;
    event_message: string;
    filename?: string; // 文件名
    model?: string;
    pipeline: string;
    pipeline_id: string;
    size?: string | number; // 视频文件大小 单位是Bytes
    timestamp: number;
    video_start?: number; // 开始时间
    video_end?: number; // 结束时间
    video?: string; // 视频地址
    storage_addr: string;
    warn: boolean;
}